package com.example.homecunter.news.newsmodel;

import com.example.common.utils.BaseEntity;
import com.example.homecunter.news.newsapi.NewsApi;
import com.example.homecunter.news.newsentity.NewsEntity;
import com.example.homecunter.news.newsentity.NewsType;
import com.example.mvvmcore.retrofit.HttpFactory;
import com.example.mvvmcore.retrofit.ProductType;
import com.example.mvvmcore.model.IModel;

import java.util.List;

import io.reactivex.Observable;

public class NewsModel implements IModel {

    public Observable<BaseEntity<List<NewsType>>> getType(){
        NewsApi newsApi = HttpFactory.getInstance().factoryTyoe(ProductType.FILE).getRetrofit("http://82.156.178.182:8087/").create(NewsApi.class);
        return newsApi.getType();
    }
    public Observable<BaseEntity<List<NewsEntity>>> getNews(int newstype,int page){
        NewsApi newsApi = HttpFactory.getInstance().factoryTyoe(ProductType.FILE).getRetrofit("http://82.156.178.182:8087/").create(NewsApi.class);
        return newsApi.getNews(newstype+"",page+"","10");
    }


}
